<?php
/**
 * 区域表单字段
 */

namespace App\Console\AdminFormFillByFormId\FieldMakers;



use App\Models\AdminUser\User;

class UserFormFieldMaker extends BaseFormFieldMaker {
    const FORM_ID         = 8;
    const FORM_TITLE      = '用户列表';
    const FORM_TABLE_NAME = 'user';

    protected function _getFormData() {
        $this->formId = self::FORM_ID;

        return [
            'id'                   => self::FORM_ID,
            'title'                => self::FORM_TITLE,
            'table_name'           => self::FORM_TABLE_NAME,
            self::FIELD_KEY        => [
                [
                    'title'       => '编号',
                    'field_name'  => 'id',
                    'field_type'  => 'text',
                    'props'       => [
                        'display_edit'   => 0,
                        'display_create' => 0,
                        'editable'       => 0,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 1,
                    ],
                    'validate'    => '[]',
                    'order'       => 1,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 1,
                ],
                [
                    'title'       => '名称',
                    'field_name'  => 'name',
                    'field_type'  => 'text',
                    'props'       => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                    ],
                    'validate'    => [
                        [
                            'required' => 'true',
                            'message'  => '请填写名称',
                        ]
                    ],
                    'order'       => 2,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 1,
                ],
                [
                    'title'       => '邮箱',
                    'field_name'  => 'email',
                    'field_type'  => 'text',
                    'props'       => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                    ],
                    'validate'    => [
                        [
                            'required' => 'true',
                            'message'  => '请填写邮箱',
                        ]
                    ],
                    'order'       => 2,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 1,
                ],
                [
                    'title'       => '密码',
                    'field_name'  => 'password',
                    'field_type'  => 'text',
                    'props'       => [
                        'display_edit'   => 0,
                        'display_create' => 1,
                        'display_detail' => 0,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                    ],
                    'validate'    => [
                        [
                            'required' => 'true',
                            'message'  => '请填写密码',
                        ]
                    ],
                    'order'       => 2,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 0,
                ],
                [
                    'title'       => '电话号码',
                    'field_name'  => 'mobile',
                    'field_type'  => 'text',
                    'props'       => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                        'default_value'  => '',
                    ],
                    'validate'    => [],
                    'order'       => 2,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 1,
                ],
                [
                    'title'          => '用户类型',
                    'field_name'     => 'type',
                    'field_type'     => 'select',
                    'props'          => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                        'default_value'  => '3',
                    ],
                    'validate'    => [
                        [
                            'required' => 'true',
                            'message'  => '请选择用户类型',
                        ]
                    ],
                    'order'          => 8,
                    'display'        => 1,
                    'searchable'     => 0,
                    'show_column'    => 1,
                    self::OPTION_KEY => [
                        [
                            'title' => '信雅超级管理员',
                            'value' => User::USER_TYPE_SUPER,
                            'order' => 1,
                        ],
                        [
                            'title' => '开发人员',
                            'value' => User::USER_TYPE_DEVELOPERS,
                            'order' => 2,
                        ],
                        [
                            'title' => '普通用户',
                            'value' => User::USER_TYPE_NORMAL,
                            'order' => 3,
                        ]
                    ]
                ],
                [
                    'title'          => '状态',
                    'field_name'     => 'status',
                    'field_type'     => 'select',
                    'props'          => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                        'default_value'  => '1',
                    ],
                    'validate'    => [
                        [
                            'required' => 'true',
                            'message'  => '请选择用户状态',
                        ]
                    ],
                    'order'          => 8,
                    'display'        => 1,
                    'searchable'     => 0,
                    'show_column'    => 1,
                    self::OPTION_KEY => [
                        [
                            'title' => '启用',
                            'value' => User::STATUS_YES,
                            'order' => 1,
                        ],
                        [
                            'title' => '禁用',
                            'value' => User::STATUS_NO,
                            'order' => 2,
                        ],
                    ]
                ],
                [
                    'title'       => '备注',
                    'field_name'  => 'remark',
                    'field_type'  => 'textarea',
                    'props'       => [
                        'display_edit'   => 1,
                        'display_create' => 1,
                        'editable'       => 1,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 0,
                        'default_value'  => '',
                    ],
                    'validate'    => [],
                    'order'       => 2,
                    'display'     => 1,
                    'searchable'  => 0,
                    'show_column' => 1,
                ],
                [
                    'title'       => '创建时间',
                    'field_name'  => 'created_at',
                    'field_type'  => 'datetime',
                    'props'       => [
                        'display_edit'   => 0,
                        'display_create' => 0,
                        'editable'       => 0,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 1,
                    ],
                    'validate'    => [],
                    'order'       => 8,
                    'display'     => 1,
                    'searchable'  => 1,
                    'show_column' => 1,
                ],
                [
                    'title'       => '更新时间',
                    'field_name'  => 'updated_at',
                    'field_type'  => 'datetime',
                    'props'       => [
                        'display_edit'   => 0,
                        'display_create' => 0,
                        'editable'       => 0,
                        'resizable'      => 1,
                        'sortable'       => 0,
                        'disabled'       => 1,
                    ],
                    'validate'    => [],
                    'order'       => 9,
                    'display'     => 1,
                    'searchable'  => 1,
                    'show_column' => 1,
                ],
            ],
            self::FILTER_GROUP_KEY => [
                [
                    'title'      => '全部',
                    'can_edit'   => 0,
                    'is_system'  => 1,
                    'uid'        => -1,
                    'order'      => 1,
                    'created_at' => $this->_mTime,
                    'updated_at' => $this->_mTime,
                    'conditions' => [],
                ],
            ],
        ];
    }
}